using DGZImp.Core.Filters;
using DGZImp.Core.Utilities.Response;
using DGZImp.MdsProject.Devices.Entities;
using DGZImp.MdsProject.IServices;
using DGZImp.MdsProject.Models;
using DGZImp.MdsProject.Services;
using DGZImp.WmsProject.IServices;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace DGZImp.MdsProject.Controllers
{

    [Route("api/[controller]/[action]")]
    public partial class MdsCustomizeController : ApiBaseController<IMdsCustomizeService>
    {

        public MdsCustomizeController(IMdsCustomizeService service)
        : base(service)
        {
        }

        [HttpPost]
        [AllowAnonymous]
        public async Task<string> LsAgvTaskSync([FromBody] LaAgvTaskSyncDto req)
        {
            return await Service.LsAgvTaskSync(req);
        }

        [HttpPost]
        [FixedToken]
        public async Task<ApiResponse<ResScadaGetDeviceTask>> ScadaGetDeviceTask([FromBody] ReqScadaGetDeviceTask req)
        {
            var r = await Service.ScadaGetDeviceTask(req);
            return ApiRes.Success(r);
        }

        [HttpPost]
        [FixedToken]
        public async Task<ApiResponse<bool>> SendDeviceEvent([FromBody] ReqSendDeviceEvent req)
        {
            var r = await Service.SendDeviceEvent(req);
            return ApiRes.Success(r);
        }

    }
}

